package com.caojing.haolemai.ui.product;

import com.caojing.haolemai.bean.ProductBean;
import com.caojing.haolemai.httputils.HttpUtils;

/**
 * Created by CaoJing on 2016/10/21.
 */
public class ProductPresenter implements ProductContract.Presenter {
    private ProductContract.Model model;
    private ProductContract.View view;

    public ProductPresenter(ProductContract.View view) {
        this.view = view;
        this.model = new ProductModel();
    }

    @Override
    public void initData(String path) {
        model.getProduct(path, new HttpUtils.HttpCallBack<ProductBean>() {
            @Override
            public void onSucess(ProductBean productBean) {
                view.onSuccessGetProduct(productBean);
            }
            @Override
            public void onFail() {
                view.onFailGetProduct("网路错误");
            }
        });
    }
}
